package com.example.controller;

import com.example.common.Result;
import com.example.entity.PetReus;
import com.example.service.PetReusService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author HY
 * @date 2025/2/15
 */
@RestController
@RequestMapping("/petReuse")
public class PetReuseController {
    @Autowired
    private PetReusService petReusService;
    @GetMapping("/selectPage")
    public Result selectAll(PetReus petReus,
                            @RequestParam(defaultValue = "1") Integer pageNum,
                            @RequestParam(defaultValue = "10") Integer pageSize){
        PageInfo<PetReus> pageInfo = petReusService.selectPage(petReus, pageSize, pageNum);
        return Result.success(pageInfo);
    }

    @PostMapping("/add")
    public Result add(@RequestBody PetReus petReus){
        petReusService.add(petReus);
        return Result.success();
    }



}
